package net.dopan.pigframe.core.bean.config;

import feign.codec.Encoder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.multipart.commons.CommonsMultipartResolver;

/**
 * @Package: com.gtinfo.core.bean.config
 * @Title:
 * @Description: (用一句话描述该文件做什么)
 * @author: 刘宽
 * @date: 2018-10-12 11:17
 */
@Configuration
public class FeignMultipartSupportConfig {

    @Bean
    public Encoder encoder(){
        return new FeignSpringFormEncoder();
    }

    @Bean
    public feign.Logger.Level multipartLoggerLevel() {
        return feign.Logger.Level.FULL;
    }

    @Bean
    public CommonsMultipartResolver commonsMultipartResolver() {
        final CommonsMultipartResolver commonsMultipartResolver = new CommonsMultipartResolver();
        commonsMultipartResolver.setMaxUploadSize(20*1024*1024);
        return commonsMultipartResolver;
    }
}
